package com.wocao.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wocao.system.entity.SysUserDo;
import com.wocao.system.mapper.SysUserMapper;
import com.wocao.system.service.SysUserService;
import org.springframework.stereotype.Service;

/**
 * 用户接口实现类
 *
 * @author sunhao
 * @date 2021/8/14
 * @see [相关类/方法]（可选）
 * @since [产品/模块版本] （可选）
 */
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUserDo> implements SysUserService {

    @Override
    public SysUserDo getSysUserByUserName(String username) {
        QueryWrapper<SysUserDo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("username", username);
        queryWrapper.eq("status", "1");
        return this.getOne(queryWrapper);
    }

    @Override
    public Boolean checkUserName(String username) {
        return getSysUserByUserName(username) != null;
    }

}
